Repository navigation
fix(ut): suppress lcov 2.x unused error for extract patterns - #468
Conversation
Reviewer's GuideTestsAllow lcov 2.x to continue coverage collection when an extract pattern matches no files by adding the unused error to the ignored error list in all three UT scripts.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/local-test.sh" line_range="34" />
<code_context>
LCOV_IGN=""
if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then
- LCOV_IGN="--ignore-errors inconsistent,mismatch"
+ LCOV_IGN="--ignore-errors inconsistent,mismatch,unused"
fi
</code_context>
<issue_to_address>
**Coverage artifacts omit expected sources**
When all configured `--extract` patterns match no tracefile records, `LCOV_IGN` suppresses the `unused` error, and the scripts do not verify the extraction result, so collection succeeds with empty or incomplete coverage artifacts.
Check that extraction selects the intended source records and fail collection when it does not.
Also at `tests/qmake-lcov-test.sh:26`, `tests/test-prj-running.sh:62`.
</issue_to_address>
### Comment 2
<location path="tests/local-test.sh" line_range="34" />
<code_context>
LCOV_IGN=""
if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then
- LCOV_IGN="--ignore-errors inconsistent,mismatch"
+ LCOV_IGN="--ignore-errors inconsistent,mismatch,unused"
fi
</code_context>
<issue_to_address>
**Test code inflates project coverage**
When test source paths do not match the removal glob, `LCOV_IGN` also reaches each `lcov --remove` command, suppressing its `unused` error; test records remain in `coverage.info`, so the report counts test code as project coverage.
Do not pass the `unused` ignore setting to `lcov --remove`, so unmatched exclusion patterns fail rather than leave test records in the report.
Also at `tests/qmake-lcov-test.sh:26`, `tests/test-prj-running.sh:62`.
</issue_to_address>| LCOV_IGN="" | ||
| if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then | ||
| LCOV_IGN="--ignore-errors inconsistent,mismatch" | ||
| LCOV_IGN="--ignore-errors inconsistent,mismatch,unused" |
There was a problem hiding this comment.
🟡 Medium · Coverage artifacts omit expected sources
When all configured --extract patterns match no tracefile records, LCOV_IGN suppresses the unused error, and the scripts do not verify the extraction result, so collection succeeds with empty or incomplete coverage artifacts.
Check that extraction selects the intended source records and fail collection when it does not.
Also at tests/qmake-lcov-test.sh:26, tests/test-prj-running.sh:62.
Prompt for AI agents
In `tests/local-test.sh` at line 34:
**Coverage artifacts omit expected sources**
When all configured `--extract` patterns match no tracefile records, `LCOV_IGN` suppresses the `unused` error, and the scripts do not verify the extraction result, so collection succeeds with empty or incomplete coverage artifacts.
Check that extraction selects the intended source records and fail collection when it does not.
Also at `tests/qmake-lcov-test.sh:26`, `tests/test-prj-running.sh:62`.| LCOV_IGN="" | ||
| if [ "${LCOV_MAJOR:-0}" -ge 2 ]; then | ||
| LCOV_IGN="--ignore-errors inconsistent,mismatch" | ||
| LCOV_IGN="--ignore-errors inconsistent,mismatch,unused" |
There was a problem hiding this comment.
🟡 Medium · Test code inflates project coverage
When test source paths do not match the removal glob, LCOV_IGN also reaches each lcov --remove command, suppressing its unused error; test records remain in coverage.info, so the report counts test code as project coverage.
Do not pass the unused ignore setting to lcov --remove, so unmatched exclusion patterns fail rather than leave test records in the report.
Also at tests/qmake-lcov-test.sh:26, tests/test-prj-running.sh:62.
Prompt for AI agents
In `tests/local-test.sh` at line 34:
**Test code inflates project coverage**
When test source paths do not match the removal glob, `LCOV_IGN` also reaches each `lcov --remove` command, suppressing its `unused` error; test records remain in `coverage.info`, so the report counts test code as project coverage.
Do not pass the `unused` ignore setting to `lcov --remove`, so unmatched exclusion patterns fail rather than leave test records in the report.
Also at `tests/qmake-lcov-test.sh:26`, `tests/test-prj-running.sh:62`.CI 镜像 lcov 2.x 对 --extract 未命中的 include pattern 直接报 ERROR (unused), 1.x 仅警告;脚本 set -e 中断导致 ut-summary.json 未产出,流水线覆盖率记 0。 统一在 lcov 2.x 版本门控的 --ignore-errors 中追加 unused。 PMS: TASK-398635 Log: CI 上 lcov 2.x extract pattern 未命中即致命,ut-summary.json 缺失 Influence: 仅影响 UT 流水线覆盖率采集脚本,lcov 1.x 行为不变
8e3895f to
a5efa87
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
fix(ut): suppress lcov 2.x unused error for extract patterns
Log: CI 镜像 lcov 2.x 对 --extract 未命中的 include pattern 直接报
ERROR (unused),1.x 仅警告;脚本 set -e 中断导致 ut-summary.json
未产出,流水线覆盖率记 0。统一在 --ignore-errors 中追加 unused。
Influence: 仅影响 UT 流水线覆盖率采集脚本,lcov 1.x 行为不变。
PMS: TASK-398635
Summary by Sourcery
Bug Fixes: